package com.huayun.code.core.utils;

import com.huayun.code.core.config.CodeGenConfig;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ConfigUtils {

    private static CodeGenConfig config;

    @Autowired
    public void setConfig(CodeGenConfig config) {
        ConfigUtils.config = config;
    }

    public static CodeGenConfig getConfig() {
        return config;
    }

    public static String[] getTables() {
        return StringUtils.split(config.getTable(), ',');
    }

    public static String getBasePackage() {
        return config.getBasePackage();
    }

    public static String getSourceFolder() {
        return config.getSourceFolder();
    }

    public static boolean getEnableSubPackages() {
        return config.isEnableSubPackage();
    }

    public static boolean getConsole() {
        return config.isConsole();
    }

    public static String getCatalog() {
        return config.getCatalog();
    }

    public static boolean getCommonFieldFilter() {
        return config.isCommonFieldFilter();
    }

}
